package com.zmj.sy.mom.srv.aps.service;

import com.zmj.sy.mom.srv.aps.bean.entity.resource.Group;
import com.zmj.sy.mom.srv.aps.bean.vo.auto.AutoReportReqVo;
import com.zmj.sy.mom.srv.aps.mapper.GroupMapper;
import com.zmj.sy.mom.srv.aps.utils.SyExceptionUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@RequiredArgsConstructor
@Service
public class AutoService {

    private final GroupMapper groupMapper;

    @Transactional
    public void report(AutoReportReqVo reqVo) {
        Group group = groupMapper.lambdaQuery().eq(Group::getMyCode, reqVo.getGroupCode()).one();
        if (group == null) {
            throw SyExceptionUtils.e("找不到该工作组");
        }

        String reportWork = group.getStartReportWorkVal();
        if (reportWork == null) {
            throw SyExceptionUtils.e("该工作组未配置开始上报工作");
        }

        System.out.println(reportWork);


    }
}
